//
//  main.m
//  OC5_数组课后作业
//
//  Created by dllo on 15/10/28.
//  Copyright (c) 2015年 dllo. All rights reserved.
//

#import <Foundation/Foundation.h>
//#import "Contact.h"
#import "AddressBook.h"

int main(int argc, const char * argv[]) {

//    Contact *c1 = [[Contact alloc] initWithName:@"张三" sex:@"男" number:13888888888 address:@"南沙街12121" group:@"朋友"];
//    Contact *c2 = [[Contact alloc] initWithName:@"李四" sex:@"女" number:13176452312 address:@"春柳22232" group:@"同学"];
//    Contact *c3 = [[Contact alloc] initWithName:@"王五" sex:@"男" number:13177766655 address:@"马栏子5552" group:@"朋友"];
//    Contact *c4 = [[Contact alloc] initWithName:@"赵六" sex:@"男" number:04 address:@"星海57752" group:@"朋友"];
//    NSMutableArray *arr = [[NSMutableArray alloc] initWithObjects:c1, c2, nil];
//    
//    // 添加
//    [arr addObject:c3];
//    
//    if ([c4 name] != nil && [c4 number]) {
//        [arr addObject:c4];
//    }else
//    {
//        NSLog(@"添加失败");
//    }
//
//    //  某一组
//    for (NSInteger i = 0; i < arr.count; i++) {
//        if ([[[arr objectAtIndex:i] group] isEqual:@"朋友"]) {
//            NSLog(@"%@", [[arr objectAtIndex:i] name]);
//        }
//    }
//
//    // 电话号码搜索
//    for (NSInteger i = 0; i < arr.count; i++) {
//        if ([[arr objectAtIndex:i] number] == 13176452312) {
//            NSLog(@"%@", [[arr objectAtIndex:i] name]);
//        }
//    }
//    
//    // 女性
//    for (NSInteger i = 0; i < arr.count; i++) {
//        if ([[[arr objectAtIndex:i] sex] isEqualTo:@"女"]) {
//            NSLog(@"%@", [[arr objectAtIndex:i] name]);
//        }
//    }
    
    // 根据姓名删除

//    for (NSInteger i = 0; i < arr.count; i++) {
//        if ([[[arr objectAtIndex:i] name] isEqualTo:@"李四"]) {
//            [arr removeObjectAtIndex:i];
//        }
//    }
//    for (NSInteger i = 0; i < arr.count; i++) {
//        NSLog(@"%@", [[arr objectAtIndex:i] name]);
//    }
    
    
    // 根据分组删除
    
//    for (NSInteger i = 0; i < arr.count; i++) {
//        if ([[[arr objectAtIndex:i] group] isEqual:@"同学"]) {
//            [arr removeObjectAtIndex:i];
//        }
//    }
//    for (NSInteger i = 0; i < arr.count; i++) {
//                NSLog(@"%@", [[arr objectAtIndex:i] name]);
//            }
    
    // 展示通讯录中所有联系人
    
//    for (NSInteger i = 0; i < arr.count; i++) {
//        NSLog(@"%@", [[arr objectAtIndex:i] name]);
//    }
    
    
/***********************AddressBook***********************************************/
    
    AddressBook *monster = [[AddressBook alloc] init];
    
    [monster tianjiaWithName:@"王五" sex:@"男" number:131131 address:@"哦喔喔" group:@"朋友"];
    
    
    
    
    return 0;
}
